﻿using System;
using LoggingLibrary;

namespace LoggingApp
{
    class Program
    {
        static void Main(string[] args)
        {
            // 创建控制台日志记录器
            var consoleLogger = LoggerFactory.CreateLogger("console");
            var consoleLoggingStrategy = new LoggingStrategy(consoleLogger);
            consoleLoggingStrategy.Log("This is a console log message.");

            // 创建文件日志记录器
            var fileLogger = LoggerFactory.CreateLogger("file", "log.txt");
            var fileLoggingStrategy = new LoggingStrategy(fileLogger);
            fileLoggingStrategy.Log("This is a file log message.");

            // 创建数据库日志记录器
            var databaseLogger = LoggerFactory.CreateLogger("database", "Data Source=logs.db");
            var databaseLoggingStrategy = new LoggingStrategy(databaseLogger);
            databaseLoggingStrategy.Log("This is a database log message.");

            // 使用装饰器模式增强日志记录器功能
            var timestampedConsoleLogger = new TimestampLoggerDecorator(consoleLogger);
            var timestampedConsoleLoggingStrategy = new LoggingStrategy(timestampedConsoleLogger);
            timestampedConsoleLoggingStrategy.Log("This is a timestamped console log message.");
        }
    }
}